<?php


namespace app\model\goods;


use app\model\team\TeamModel;
use app\model\user\UserModel;
use think\Model;

class OrderModel extends Model
{
    protected $name = 'order';
    protected $autoWriteTimestamp = true;

    protected $append = ['reserve_time_txt'];

    public function user()
    {
        return $this->hasOne(UserModel::class, 'id', 'user_id')->bind(['username']);
    }

    public function getReserveTimeTxtAttr($value, $data)
    {
        return date('Y-m-d H:i', $data['reserve_time']);
    }
}